// ANIP_TODO: in the future, add multi-edit capabilities.
// Requires new state flags?

#pragma once

#include <memory>
#include "common.h"
#include "bind.h"
#include "editor/settings.h"

namespace anip
{
	namespace editor
	{
		class Property
		{
		public:
			Property(Property&) = delete;

			virtual wstring name() const = 0;
			virtual wstring description() const = 0;
			//function<void(Property& self)> onChanged;

			virtual void createUI(ui::Container& c) {}

			// Note: Implementations don't have to mark their `Control`s for
			// deletion since the caller will always do this
			virtual void destroyUI(ui::Container& c) {}

		protected:
			Property() {};
		};

		class NumProperty : public Property
		{
		private:
			struct Impl;
			std::unique_ptr<Impl> _pimpl;

		public:
			NumProperty(const wstring& name, const wstring& description, 
				float val, float min = 0, float max = 0);

			~NumProperty();

			wstring name() const override { return _name; }
			wstring description() const override { return _desc; }

			//float getMin() const { return _min; }
			//float getMax() const { return _max; }

			void setRange(float min, float max);

			bfloat value;
			bool lBound, rBound;
			bool onlyIntegers = false;
			
			// ANIP_TODO: bool canUseNodes;

			void createUI(ui::Container& c) override;
			void destroyUI(ui::Container& c) override;

		private:
			wstring _name, _desc;
		};
	}
}